function loadHomePage() {
    $("#mainDiv").load("pageParts/homePage.html");
}


function menuButtonHomeAction() {
    loadHomePage();
}

function loadCheckCreditPage() {
    $("#mainDiv").load("pageParts/creditCheckPage.html");
}


function menuButtonCheckCreditAction() {
    loadCheckCreditPage();
}

function loadLoginPage() {
    $("#mainDiv").load("pageParts/loginPage.html");
}


function menuButtonLoginAction() {
    loadLoginPage();
}

function loadAboutPage() {
    $("#mainDiv").load("pageParts/aboutPage.html");
   
}


function menuButtonAboutAction() {
    loadAboutPage();
     return false;
}

function kredytActive() {
    document.liczKredyt.Mk.disabled = false;
    document.liczKredyt.MkRange.disabled = false;
}

function kredytUnactive() {
    document.liczKredyt.Mk.disabled = true;
    document.liczKredyt.MkRange.disabled = true;
}


function loadRegisterPage(){
    $("#mainDiv").load("pageParts/registerPage.html");
}

function displayMessages(messages, element) {
    // Jeśli kontener na komunikaty nie istnieje, tworzymy go.
    if ($(element).length == 0) {
        $('#mainDiv').prepend('<ul id="messages"></ul>');
    }
    // Usuwamy dotychczasowe komunikaty.
    $(element).empty();
    
    for(var i in messages) {
        $(element).append('<li>' + messages[i] + '</li>');
    }
}